<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位-绝对定位</title>
    <style>
        
        .f{
            width: 300px;
            height: 300px;
            background-color: cadetblue;
            /* 1.绝对定位  定位原点是和父元素有关的 （父元素也要定位） 会脱离文档流 absolute */
            position: absolute;
            left: 100px;
            top: 100px;
        }

        .s{
            width: 100px;
            height: 100px;
            background-color: lightcoral;
            /* 当子元素设置绝对定位时，移动参照父元素 */
            position: absolute;
            left: 0px;
            top: 0px;
            transition: all 1s linear;
        }

        .s:hover{
            left: 100px;
            top: 100px;
        }

        .clear{
            width: 500px;
            border-top: 3px solid orange;
        }
    </style>
</head>
<body>
    <div class="f">
        <div class="s"></div>
    </div>
    <div class="clear">我是参照物</div>
</body>
</html>